<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>uCXpresso.BLE: CThread Class Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../upnp.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">uCXpresso.BLE
   &#160;<span id="projectnumber">v1.0.4</span>
   </div>
   <div id="projectbrief">RTOS C++ Framework for Bluetooth Low Energy</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="../../modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="../../annotated.html"><span>Classes</span></a></li>
      <li><a href="../../examples.html"><span>Examples</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="../../search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="../../annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="../../classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="../../hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="../../functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('d0/d26/class_c_thread.html','../../');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Groups</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="../../d4/d18/class_c_thread-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">CThread Class Reference<div class="ingroups"><a class="el" href="../../d8/dba/group___r_t_o_s.html">RTOS</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &quot;<a class="el" href="../../db/dd5/thread_8h_source.html">class/thread.h</a>&quot;</code></p>
<div class="dynheader">
Inheritance diagram for CThread:</div>
<div class="dyncontent">
 <div class="center">
  <img src="../../d0/d26/class_c_thread.png" usemap="#CThread_map" alt=""/>
  <map id="CThread_map" name="CThread_map">
<area href="../../dc/dac/class_c_object.html" alt="CObject" shape="rect" coords="72,0,134,24"/>
<area href="../../d7/d03/classble_serial.html" title="bleSerial class is a ble core, and inherits from CStream class to provide the stream virtual function..." alt="bleSerial" shape="rect" coords="0,112,62,136"/>
<area href="../../d4/d37/class_c_debug.html" alt="CDebug" shape="rect" coords="72,112,134,136"/>
<area href="../../de/dba/class_c_shell.html" alt="CShell" shape="rect" coords="144,112,206,136"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a3ebabcc071634508511ae2fc7b868ab7"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#a3ebabcc071634508511ae2fc7b868ab7">start</a> (const char *name, int stack=DEF_THREAD_STACK, <a class="el" href="../../db/dff/group___enumerations.html#ga51e24e4c0498282f564e92975e020c1d">PRIORITIES_T</a> priority=<a class="el" href="../../db/dff/group___enumerations.html#gga51e24e4c0498282f564e92975e020c1daf8a2513dc9a78bb09c0520af65a3f402">PRI_LOW</a>)</td></tr>
<tr class="separator:a3ebabcc071634508511ae2fc7b868ab7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aacf955d1852e74da1f989251955ee6ec"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#aacf955d1852e74da1f989251955ee6ec">start</a> ()</td></tr>
<tr class="separator:aacf955d1852e74da1f989251955ee6ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac8c53aa8c145fc4ac70fa6d825b95742"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#ac8c53aa8c145fc4ac70fa6d825b95742">resume</a> ()</td></tr>
<tr class="separator:ac8c53aa8c145fc4ac70fa6d825b95742"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a53e71e6db2221cd1c45aec21953d4aad"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#a53e71e6db2221cd1c45aec21953d4aad">suspend</a> ()</td></tr>
<tr class="separator:a53e71e6db2221cd1c45aec21953d4aad"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac0227eda51725b795a461a768703f588"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#ac0227eda51725b795a461a768703f588">getStackHighWaterMark</a> ()</td></tr>
<tr class="separator:ac0227eda51725b795a461a768703f588"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a51dbe9909ce528b4113d2cc27314e965"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#a51dbe9909ce528b4113d2cc27314e965">isSuspend</a> ()</td></tr>
<tr class="separator:a51dbe9909ce528b4113d2cc27314e965"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1e9cce461d8dfb3889cea24f1a703f6f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../db/dff/group___enumerations.html#ga25ee4013cc565a18ac2f4039b4ad441b">TASK_STATE_T</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#a1e9cce461d8dfb3889cea24f1a703f6f">getState</a> ()</td></tr>
<tr class="separator:a1e9cce461d8dfb3889cea24f1a703f6f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6b0703ae0cc085a0c0aaa55b6945575b"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#a6b0703ae0cc085a0c0aaa55b6945575b">setPriority</a> (<a class="el" href="../../db/dff/group___enumerations.html#ga51e24e4c0498282f564e92975e020c1d">PRIORITIES_T</a> p)</td></tr>
<tr class="separator:a6b0703ae0cc085a0c0aaa55b6945575b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac30b0a1f51549a97b88771692319c0e4"><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="../../db/dff/group___enumerations.html#ga51e24e4c0498282f564e92975e020c1d">PRIORITIES_T</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#ac30b0a1f51549a97b88771692319c0e4">getPriority</a> ()</td></tr>
<tr class="separator:ac30b0a1f51549a97b88771692319c0e4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa291909bc3ff7cc0decf46c885a7a725"><td class="memItemLeft" align="right" valign="top">LPCTSTR&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#aa291909bc3ff7cc0decf46c885a7a725">getName</a> ()</td></tr>
<tr class="separator:aa291909bc3ff7cc0decf46c885a7a725"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4a0f0727be4714cef1e24150a869d403"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#a4a0f0727be4714cef1e24150a869d403">isAlive</a> ()</td></tr>
<tr class="separator:a4a0f0727be4714cef1e24150a869d403"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a15041136818470124d097d790d55a6e5"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#a15041136818470124d097d790d55a6e5">kill</a> ()</td></tr>
<tr class="separator:a15041136818470124d097d790d55a6e5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab2513fd0fcad30e2e6605609c91f1984"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#ab2513fd0fcad30e2e6605609c91f1984">isThread</a> ()</td></tr>
<tr class="separator:ab2513fd0fcad30e2e6605609c91f1984"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a743d4325b7e7da494283f3292773ff77"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#a743d4325b7e7da494283f3292773ff77">resumeAll</a> ()</td></tr>
<tr class="separator:a743d4325b7e7da494283f3292773ff77"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2c09328581bd4e4a3e9e793f3376a92a"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#a2c09328581bd4e4a3e9e793f3376a92a">suspendAll</a> ()</td></tr>
<tr class="separator:a2c09328581bd4e4a3e9e793f3376a92a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeb4cafe42d6cfc41294cf5dedcee8678"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#aeb4cafe42d6cfc41294cf5dedcee8678">enterCriticalSection</a> ()</td></tr>
<tr class="separator:aeb4cafe42d6cfc41294cf5dedcee8678"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aab3a51062666552690be49b8e8027161"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#aab3a51062666552690be49b8e8027161">exitCriticalSection</a> ()</td></tr>
<tr class="separator:aab3a51062666552690be49b8e8027161"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a071c3d3b3c19a7bd6a01aca073a9b4d7"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d26/class_c_thread.html#a071c3d3b3c19a7bd6a01aca073a9b4d7">run</a> ()</td></tr>
<tr class="separator:a071c3d3b3c19a7bd6a01aca073a9b4d7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>The <a class="el" href="../../d0/d26/class_c_thread.html">CThread</a> class provide the multi-tasking services. </p>
<dl class="section note"><dt>Note</dt><dd>The <a class="el" href="../../d0/d26/class_c_thread.html">CThread</a> class is an abstract class, child class have to implement the <a class="el" href="../../d0/d26/class_c_thread.html#a071c3d3b3c19a7bd6a01aca073a9b4d7">run()</a> member. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="../../d4/d70/_2ble_2ble_heartrate_2src_2main_8cpp-example.html#_a1">/ble/ble_heartrate/src/main.cpp</a>, <a class="el" href="../../db/de1/_2misc_2garbage_collector_2src_2main_8cpp-example.html#_a1">/misc/garbage_collector/src/main.cpp</a>, <a class="el" href="../../d1/d0a/_2peripheral_2uart_2src_2main_8cpp-example.html#_a1">/peripheral/uart/src/main.cpp</a>, <a class="el" href="../../d0/d46/_2peripheral_2watchdog_2src_2main_8cpp-example.html#_a0">/peripheral/watchdog/src/main.cpp</a>, and <a class="el" href="../../da/da9/_2rtos_2blink_thread_2src_2main_8cpp-example.html#_a0">/rtos/blink_thread/src/main.cpp</a>.</dd>
</dl></div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="aeb4cafe42d6cfc41294cf5dedcee8678"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void CThread::enterCriticalSection </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Call the <a class="el" href="../../d0/d26/class_c_thread.html#aeb4cafe42d6cfc41294cf5dedcee8678">CThread::enterCriticalSection()</a> to disable interrupts. </p>

</div>
</div>
<a class="anchor" id="aab3a51062666552690be49b8e8027161"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void CThread::exitCriticalSection </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Call the <a class="el" href="../../d0/d26/class_c_thread.html#aab3a51062666552690be49b8e8027161">CThread::exitCriticalSection()</a> to enable interrupts. </p>

</div>
</div>
<a class="anchor" id="aa291909bc3ff7cc0decf46c885a7a725"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LPCTSTR CThread::getName </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Call the member function to retrieve the task's name. </p>

</div>
</div>
<a class="anchor" id="ac30b0a1f51549a97b88771692319c0e4"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual <a class="el" href="../../db/dff/group___enumerations.html#ga51e24e4c0498282f564e92975e020c1d">PRIORITIES_T</a> CThread::getPriority </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Call the member function to get the task's priority. </p>
<dl class="section return"><dt>Returns</dt><dd>PRIORITIES_T </dd></dl>

</div>
</div>
<a class="anchor" id="ac0227eda51725b795a461a768703f588"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t CThread::getStackHighWaterMark </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Call the member function to check the stack high water mark. </p>
<dl class="section note"><dt>Note</dt><dd>Or use the shell and type 'task' to check all tasks status. </dd></dl>

</div>
</div>
<a class="anchor" id="a1e9cce461d8dfb3889cea24f1a703f6f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="../../db/dff/group___enumerations.html#ga25ee4013cc565a18ac2f4039b4ad441b">TASK_STATE_T</a> CThread::getState </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Retrieve the state of thread object (task) </p>

</div>
</div>
<a class="anchor" id="a4a0f0727be4714cef1e24150a869d403"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool CThread::isAlive </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>isAlive is to check the thread is in alive (for run-loop) </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="../../d4/d70/_2ble_2ble_heartrate_2src_2main_8cpp-example.html#a9">/ble/ble_heartrate/src/main.cpp</a>, <a class="el" href="../../db/de1/_2misc_2garbage_collector_2src_2main_8cpp-example.html#a4">/misc/garbage_collector/src/main.cpp</a>, and <a class="el" href="../../da/da9/_2rtos_2blink_thread_2src_2main_8cpp-example.html#a4">/rtos/blink_thread/src/main.cpp</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="a51dbe9909ce528b4113d2cc27314e965"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool CThread::isSuspend </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Call the member function to check the task is in suspended or not. </p>
<dl class="section return"><dt>Returns</dt><dd>true if task in suspended. otherwise, the task in running. </dd></dl>

</div>
</div>
<a class="anchor" id="ab2513fd0fcad30e2e6605609c91f1984"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool CThread::isThread </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p><a class="el" href="../../d0/d26/class_c_thread.html#ab2513fd0fcad30e2e6605609c91f1984">isThread()</a>, check the class is inherited from <a class="el" href="../../d0/d26/class_c_thread.html">CThread</a> </p>

<p>Reimplemented from <a class="el" href="../../dc/dac/class_c_object.html#a26a76c241a4d62d2efdac57d2cfe4c0f">CObject</a>.</p>

</div>
</div>
<a class="anchor" id="a15041136818470124d097d790d55a6e5"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void CThread::kill </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>kill the thread and the <a class="el" href="../../d0/d26/class_c_thread.html#a4a0f0727be4714cef1e24150a869d403">isAlive()</a> will return false </p>

</div>
</div>
<a class="anchor" id="ac8c53aa8c145fc4ac70fa6d825b95742"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void CThread::resume </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Call the member function to resume the thread.</p>
<div class="fragment"><div class="line">Example:</div>
<div class="line">    <span class="keywordtype">int</span> main() {</div>
<div class="line">        ...</div>
<div class="line">        CLedTask ledTask;</div>
<div class="line">        ledTask.start(<span class="stringliteral">&quot;led&quot;</span>);</div>
<div class="line">        ...</div>
<div class="line">        ledTask.suspend();      <span class="comment">// suspend the ledTask</span></div>
<div class="line">        ...</div>
<div class="line">        <span class="keywordflow">if</span> ( ledTask.isSuspend() ) {</div>
<div class="line">            ledTask.resume();   <span class="comment">// resume the ledTask</span></div>
<div class="line">        }</div>
<div class="line">        ...</div>
<div class="line">    }</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="a743d4325b7e7da494283f3292773ff77"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void CThread::resumeAll </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Call the <a class="el" href="../../d0/d26/class_c_thread.html#a743d4325b7e7da494283f3292773ff77">CThread::resumeAll()</a> to resume all suspended tasks. </p>

</div>
</div>
<a class="anchor" id="a071c3d3b3c19a7bd6a01aca073a9b4d7"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void CThread::run </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>The run member function is the task main procedure, and callback by RTOS when task start.</p>
<div class="fragment"><div class="line">Example:</div>
<div class="line">        <span class="keyword">class </span>CLedTask: <span class="keyword">public</span> <a class="code" href="../../d0/d26/class_c_thread.html">CThread</a> {</div>
<div class="line">        <span class="keyword">protected</span>:</div>
<div class="line">            <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="../../d0/d26/class_c_thread.html#a071c3d3b3c19a7bd6a01aca073a9b4d7">run</a>() {</div>
<div class="line">                <a class="code" href="../../d7/db9/class_c_pin.html">CPin</a> led(<a class="code" href="../../db/dff/group___enumerations.html#gga65a2241721e4acb573e0c3fe29ac432fa8379bbaa96d151e6adac488b2a147b7a">LED2</a>);</div>
<div class="line">                <span class="keywordflow">while</span>( <a class="code" href="../../d0/d26/class_c_thread.html#a4a0f0727be4714cef1e24150a869d403">isAlive</a>() ) {    <span class="comment">// check thread alive</span></div>
<div class="line">                    led = !led;</div>
<div class="line">                    sleep(200);</div>
<div class="line">                }</div>
<div class="line">            }</div>
<div class="line">        };</div>
<div class="line"></div>
<div class="line">        <span class="keywordtype">int</span> main() {</div>
<div class="line">            ...</div>
<div class="line">            CLedTask ledTask;</div>
<div class="line">            ledTask.start(<span class="stringliteral">&quot;led&quot;</span>);   <span class="comment">// default stack=128, default priority=low</span></div>
<div class="line">            ...</div>
<div class="line">        }</div>
</div><!-- fragment --> <dl class="section remark"><dt>Remarks</dt><dd>The <a class="el" href="../../d0/d26/class_c_thread.html#a071c3d3b3c19a7bd6a01aca073a9b4d7">run()</a> is a pure virtual function, must implement by inheritor. </dd></dl>
<dl class="section note"><dt>Note</dt><dd>if end the <a class="el" href="../../d0/d26/class_c_thread.html#a071c3d3b3c19a7bd6a01aca073a9b4d7">run()</a> member function, the <a class="el" href="../../d0/d26/class_c_thread.html">CThread</a> object will be destroyed and collected. </dd></dl>

<p>Reimplemented in <a class="el" href="../../d4/d37/class_c_debug.html#a9a3e40cc8ee5d0c2a41577f658779c71">CDebug</a>, and <a class="el" href="../../de/dba/class_c_shell.html#a1565a93fad9a1e35e05a597889ad130f">CShell</a>.</p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="../../d4/d70/_2ble_2ble_heartrate_2src_2main_8cpp-example.html#a2">/ble/ble_heartrate/src/main.cpp</a>, <a class="el" href="../../db/de1/_2misc_2garbage_collector_2src_2main_8cpp-example.html#a2">/misc/garbage_collector/src/main.cpp</a>, <a class="el" href="../../d1/d0a/_2peripheral_2uart_2src_2main_8cpp-example.html#a2">/peripheral/uart/src/main.cpp</a>, <a class="el" href="../../d0/d46/_2peripheral_2watchdog_2src_2main_8cpp-example.html#a1">/peripheral/watchdog/src/main.cpp</a>, and <a class="el" href="../../da/da9/_2rtos_2blink_thread_2src_2main_8cpp-example.html#a1">/rtos/blink_thread/src/main.cpp</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="a6b0703ae0cc085a0c0aaa55b6945575b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void CThread::setPriority </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../db/dff/group___enumerations.html#ga51e24e4c0498282f564e92975e020c1d">PRIORITIES_T</a>&#160;</td>
          <td class="paramname"><em>p</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Call the member function to change the task's priority. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">p</td><td>is PRIORITIES_T to set a new priority for the task. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a3ebabcc071634508511ae2fc7b868ab7"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool CThread::start </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>stack</em> = <code>DEF_THREAD_STACK</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../db/dff/group___enumerations.html#ga51e24e4c0498282f564e92975e020c1d">PRIORITIES_T</a>&#160;</td>
          <td class="paramname"><em>priority</em> = <code><a class="el" href="../../db/dff/group___enumerations.html#gga51e24e4c0498282f564e92975e020c1daf8a2513dc9a78bb09c0520af65a3f402">PRI_LOW</a></code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Call the member function to start the thread. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>is a descriptive name for the task. </td></tr>
    <tr><td class="paramname">stack</td><td>is a integer value to specified as the number of stack can hold-not the number of bytes. </td></tr>
    <tr><td class="paramname">priority</td><td>at which the task should run. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful; otherwise, crate task failed.</dd></dl>
<div class="fragment"><div class="line">Example:</div>
<div class="line">        <span class="keyword">class </span>CLedTask: <span class="keyword">public</span> <a class="code" href="../../d0/d26/class_c_thread.html">CThread</a> {</div>
<div class="line">        <span class="keyword">protected</span>:</div>
<div class="line">            <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="../../d0/d26/class_c_thread.html#a071c3d3b3c19a7bd6a01aca073a9b4d7">run</a>() {</div>
<div class="line">                <a class="code" href="../../d7/db9/class_c_pin.html">CPin</a> led(<a class="code" href="../../db/dff/group___enumerations.html#gga65a2241721e4acb573e0c3fe29ac432fa8379bbaa96d151e6adac488b2a147b7a">LED2</a>);</div>
<div class="line">                <span class="keywordflow">while</span>( <a class="code" href="../../d0/d26/class_c_thread.html#a4a0f0727be4714cef1e24150a869d403">isAlive</a>() ) {    <span class="comment">// Is thread in alive?  (when thread be kill, the isAlive will return false)</span></div>
<div class="line">                    led = !led;</div>
<div class="line">                    sleep(200);</div>
<div class="line">                }</div>
<div class="line">            }</div>
<div class="line">        };</div>
<div class="line"></div>
<div class="line">        <span class="keywordtype">int</span> main() {</div>
<div class="line">            ...</div>
<div class="line">            CLedTask ledTask;</div>
<div class="line">            ledTask.start(<span class="stringliteral">&quot;led&quot;</span>);   <span class="comment">// default stack=128, default priority=low</span></div>
<div class="line">            ...</div>
<div class="line">        }</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="aacf955d1852e74da1f989251955ee6ec"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool CThread::start </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Call the member function to start the thread. </p>
<dl class="section note"><dt>Note</dt><dd>the <a class="el" href="../../d0/d26/class_c_thread.html#aacf955d1852e74da1f989251955ee6ec">start()</a> is an overload member function of <a class="el" href="../../d0/d26/class_c_thread.html">CThread</a>. </dd></dl>

<p>Reimplemented in <a class="el" href="../../d4/d37/class_c_debug.html#a40d1b7f50b76311b3a7fb148e5b7e2ea">CDebug</a>, and <a class="el" href="../../de/dba/class_c_shell.html#a670f66f552494dfce94ee297ae0f659a">CShell</a>.</p>

</div>
</div>
<a class="anchor" id="a53e71e6db2221cd1c45aec21953d4aad"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void CThread::suspend </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Call the member function to suspend the thread.</p>
<div class="fragment"><div class="line">Example:</div>
<div class="line">    <span class="keywordtype">int</span> main() {</div>
<div class="line">        ...</div>
<div class="line">        CLedTask ledTask;</div>
<div class="line">        ledTask.start(<span class="stringliteral">&quot;led&quot;</span>);</div>
<div class="line">        ...</div>
<div class="line">        ledTask.suspend();      <span class="comment">// suspend the ledTask</span></div>
<div class="line">        ...</div>
<div class="line">        <span class="keywordflow">if</span> ( ledTask.isSuspend() ) {</div>
<div class="line">            ledTask.resume();   <span class="comment">// resume the ledTask</span></div>
<div class="line">        }</div>
<div class="line">        ...</div>
<div class="line">    }</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="a2c09328581bd4e4a3e9e793f3376a92a"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void CThread::suspendAll </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Call the <a class="el" href="../../d0/d26/class_c_thread.html#a2c09328581bd4e4a3e9e793f3376a92a">CThread::suspendAll()</a> to suspend all running tasks. </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="../../d0/d26/class_c_thread.html">CThread</a></li>
    <li class="footer">Generated on Fri Apr 11 2014 23:43:26 for uCXpresso.BLE by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>
